<template>
  <div>
  </div>
</template>

<script lang="ts">
import {ref} from 'vue'
import { catchError, debounce, throttle } from "../utils/decorator/index";
class TestD{
  @throttle(2000)
  fnthrottle() {
    console.log('fn-throttle')
  }
  @debounce(1000)
  fndebounce() {
    console.log('fn-debounce')
  }
  @catchError('userInfo.name 不存在')
  getName() {
    const userInfo: any = undefined;
    return userInfo.name;
  }
  @catchError('userInfo.name 不存在')
  getdata() {
    return new Promise((resolve, reject)=>{
      setTimeout(()=>{
        resolve("resolve=====>")
      },1000)
    })
  }
}
  
export default {
    setup() {
       
        const testa = new TestD()
        setInterval(testa.fnthrottle,50);
        setInterval(testa.fndebounce,1500);
        testa.getName();
        testa.getdata();
        return {
        }
    }
}
</script>
